﻿using System;
using System.ComponentModel.Composition;

namespace AlbumArtOrganizer.Plugins.Bing.Model
{
    [Export(AlbumArtOrganizer.Plugins.Bing.ImageFinder.ImageFinder.OPTIONCONTRACTNAME, typeof(AlbumArtOrganizer.Model.IOption))]
    public class OptionSearchFormatString : AlbumArtOrganizer.Model.OptionString
    {
        public override string Title
        {
            get
            {
                return "Search format string";
            }
        }

        public override string Description
        {
            get
            {
                return "{0} is for artist name, {1} is for album title.";
            }
        }

        string _value = null;
        public override string Value
        {
            get
            {
                if (String.IsNullOrEmpty(_value))
                {
                    _value = Properties.Settings.Default.OptionSearchFormatString;
                }
                return _value;
            }
            set
            {
                _value = value;
                Properties.Settings.Default.OptionSearchFormatString = value;
                Properties.Settings.Default.Save();
            }
        }
    }
}
